package com.springboot.onlinemusicserver.exception;

import com.springboot.onlinemusicserver.utils.common.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * Created with IntelliJ IDEA.
 * Description :
 * User: jiume
 * Date: 2025-05-29
 * Time: 13:50
 */
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(RuntimeException.class) // 处理异常
    public Result<String> handleException(Exception e) {
        // 对所有的异常进行返回
        return Result.error(e.getMessage());
    }
}
